@import "../common/var";

@mixin button-plain($color) {
    color: $color;
    background: mix($white, $color, 90%);
    border-color: mix($white, $color, 60%);

    &:hover,
    &:focus {
        background: $color;
        border-color: $color;
        color: $white;
    }

    &:active {
        background: mix($black, $color, $--button-active-shade-percent);
        border-color: mix($black, $color, $--button-active-shade-percent);
        color: $white;
        outline: none;
    }

    &.is-disabled {
        &,
        &:hover,
        &:focus,
        &:active {
            color: mix($white, $color, 40%);
            background-color: mix($white, $color, 90%);
            border-color: mix($white, $color, 80%);
        }
    }
}

@mixin button-variant($color, $background-color, $border-color) {
    color: $color;
    background-color: $background-color;
    border-color: $border-color;

    &:hover,
    &:focus {
        background: mix($white, $background-color, $--button-hover-tint-percent);
        border-color: mix($white, $border-color, $--button-hover-tint-percent);
        color: $color;
    }

    &:active {
        background: mix($black, $background-color, $--button-active-shade-percent);
        border-color: mix($black, $border-color, $--button-active-shade-percent);
        color: $color;
        outline: none;
    }

    &.is-active {
        background: mix($black, $background-color, $--button-active-shade-percent);
        border-color: mix($black, $border-color, $--button-active-shade-percent);
        color: $color;
    }

    &.is-disabled {
        &,
        &:hover,
        &:focus,
        &:active {
            color: $white;
            background-color: mix($background-color, $white);
            border-color: mix($border-color, $white);
        }
    }

    &.is-plain {
        @include button-plain($background-color);
    }
}

@mixin button-size($button-height, $padding-horizontal, $font-size, $border-radius) {
    padding: 0 $padding-horizontal;
    height: $button-height;
    line-height: $button-height - 2px;
    font-size: $font-size;
    border-radius: $border-radius;
    &.is-round {
        padding: 0 $padding-horizontal;
    }
}
